package cn.hncu.booksManagementSystem.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Description:
 *	时间处理工具
 */
public class DateUtil {
	private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日  HH:mm:ss");
	private static SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	private DateUtil() {}
	
	public static String long2String(long time) {
		return sdf.format(new Date(time));
	}
	
	public static long string2Long(String time) throws ParseException {
		return sdf2.parse(time).getTime();
	}
}
